From: David Kastrup Date: Fri, 11 Jun 2004 00:08:37 +0000 (+0000) Subject: (match_limit): Don't flag an error if match-data X-Git-Tag: archive/raspbian/1%29.2+1-2+rpi1~1^2~22054 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=9f197a3cf79785fadf2cfbdc4a2222f838146f57;p=emacs.git (match_limit): Don't flag an error if match-data exceeding the allocated search_regs.num_regs gets requested, just return Qnil. --- diff --git a/src/ChangeLog b/src/ChangeLog index 4c26dcc3313..257e332b551 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2004-06-11 David Kastrup + + * search.c (match_limit): Don't flag an error if match-data + exceeding the allocated search_regs.num_regs gets requested, just + return Qnil. + 2004-06-08 Miles Bader * xfaces.c (push_named_merge_point): Return 0 when a cycle is detected. diff --git a/src/search.c b/src/search.c index e5e4c3f867a..24f21f053a5 100644 --- a/src/search.c +++ b/src/search.c @@ -2622,9 +2622,9 @@ match_limit (num, beginningp) CHECK_NUMBER (num); n = XINT (num); - if (n < 0 || n >= search_regs.num_regs) + if (n < 0 || search_regs.num_regs <= 0) args_out_of_range (num, make_number (search_regs.num_regs)); - if (search_regs.num_regs <= 0 + if (n >= search_regs.num_regs || search_regs.start[n] < 0) return Qnil; return (make_number ((beginningp) ? search_regs.start[n]